1. Field of the Invention
The present invention relates to the field of Web page development and, more particularly, to providing real-time validation feedback for text input fields using regular expression evaluation during text entry.
2. Description of the Related Art
The Internet has become a vital means of conducting business. Consumers visit a multitude of Web sites to purchase items, subscribe to newsletters, share information, and other such activities. Many Web sites utilize Web forms to collect necessary information from a user. For example, a user typically needs to provide a valid email address when subscribing to a newsletter.
A persistent problem that plagues Web form fields is the proper formatting of data into text fields. A disconnect often exists between a developer and a user as to the proper or an acceptable format for a specific text field. For example, a social security number can be entered with or without dashes.
Web developers often resort to providing an example of the expected formatting in the Web form. However, this does not guarantee that the user will enter the data accordingly. Thus, many developers employ a variety of scripts to validate the formatting of entered data.
The conventional implementations of these validation scripts, while useful, create an additional set of issues. Conventional validation scripts determine the validity of an inputted text string in its entirety regardless of how many characters are acceptable. For example, if a user mistypes a comma instead of a period in their email address, the entire email text field is flagged as invalid. Many forms clear text fields that have been flagged as invalid, which increases a user's frustration and does not offer assistance in correcting the error.
Conventional validation scripts require that the developer include all possible valid and/or invalid character permutations in the actual code. The inclusion of these permutations increases script size and decreases performance. Additionally, future modifications to the range of valid permutations can result in having to rewrite the entire script.
What is needed is a solution that provides real-time validation feedback during entry into a text input field. That is, characters are validated as they are inputted with invalid characters being visually accentuated. For example, any numbers accidentally typed into the text field for a city name would be highlighted. Ideally, this solution would leverage regular expressions to define expected input formats.